/*****************************************************
1st Draft Dofile for Support for DRR paper
******************************************************/

clear
capture: log close
pause on
set more off
use "replication.dta"

ssc install estout

label variable home_hazards_1 "Hazards"
label variable during_quake_1 "Strategy"
label variable personal_supplies_1 "Personal Kit"
label variable household_supplies_1 "Household Kit"
label variable building_weaknesses_1 "Building Weaknesses"
label variable risk_highlow "Seismic Risk"
label variable hhincome "Household Income"



/* Figure 2 - Determinants of Individual Preparedness */

eststo clear

ologit home_hazards_1 risk_highlow hhincome age home married dem rep ind ideology male rel_attendance employed education white black latinx asian
coefplot, drop(_cons) xline(0, lpattern(dash) lcolor(black)) graphregion(fcolor(white)) lcolor(black) msize(small) graphregion(color(white)) mcolor(black) ciopts(lcolor(black)) subtitle("Hazards", margin(small))
estimates store c1, title(column 1)

/* Column 2 */

ologit during_quake_1 risk_highlow hhincome age home married dem rep ind ideology male rel_attendance education employed white black latinx asian
coefplot, drop(_cons) xline(0, lpattern(dash) lcolor(black)) graphregion(fcolor(white)) lcolor(black) msize(small) graphregion(color(white)) mcolor(black) ciopts(lcolor(black)) subtitle("Strategy", margin(small))
estimates store c2, title(column 2)

/* Column 3 */

ologit personal_supplies_1 risk_highlow hhincome age home married dem rep ind ideology male rel_attendance education employed white black latinx asian
coefplot, drop(_cons) xline(0, lpattern(dash) lcolor(black)) graphregion(fcolor(white)) lcolor(black) msize(small) graphregion(color(white)) mcolor(black) ciopts(lcolor(black)) subtitle("Personal Kit", margin(small))
estimates store c3, title(column 3)

/* Column 4 */

ologit household_supplies_1 risk_highlow hhincome age home married dem rep ind ideology male rel_attendance education employed white black latinx asian
coefplot, drop(_cons) xline(0, lpattern(dash) lcolor(black)) graphregion(fcolor(white)) lcolor(black) msize(small) graphregion(color(white)) mcolor(black) ciopts(lcolor(black)) subtitle("Household Kit", margin(small))
estimates store c4, title(column 4)

/* Column 5 */

ologit building_weaknesses_1 risk_highlow hhincome age home married dem rep ind ideology male rel_attendance education employed white black latinx asian
coefplot, drop(_cons) xline(0, lpattern(dash) lcolor(black)) graphregion(fcolor(white)) lcolor(black) msize(small) graphregion(color(white)) mcolor(black) ciopts(lcolor(black)) subtitle("Building Weaknesses", margin(small))
estimates store c5, title(column 5)


/* Figure 2 - Determinants of Individual Preparedness */
coefplot c1 c2 c3 c4 c5, drop(_cons cut1 cut2 cut3)  xline(0, lpattern(dash) lcolor(black)) graphregion(fcolor(white)) lcolor(black) msize(tiny) graphregion(color(white)) subtitle("Determinants of Individual Preparedness", margin(small)) xtitle(Log-Odds Regression Coefficient)

/* Table A3- Ordered Logit Regression: Determinants of Individual Preparedness. */
esttab c1 c2 c3 c4 c5 using "ologit_drr.tex", b(3) replace unstack nobaselevels label nogap se star (+ 0.1 * 0.05 ** 0.01 *** 0.001) pr2 title({Determinants of Individual Preparedness.}\label{tab1})


/* Table A1 - Descriptive Statistics */

estpost summarize home_hazards_1 during_quake_1 personal_supplies_1 household_supplies_1 building_weaknesses_1 risk_highlow hhincome age home married dem rep ind ideology male rel_attendance education employed  white black latinx asian
esttab using "descriptive.tex", cells("count mean(fmt(%4.3f)) sd(fmt(%4.3f)) min max") noobs label replace title({Descriptive Statistics.}\label{tab1})

/* Table A2 - Descriptive Statistics */

estpost correlate home_hazards_1 during_quake_1 personal_supplies_1 household_supplies_1 building_weaknesses_1 risk_highlow hhincome age home married dem rep ind ideology male rel_attendance education employed  white black latinx asian, matrix listwise
esttab using "Correlation Matrix.rtf", unstack not noobs label compress replace
esttab using "Correlation Matrix.tex", unstack not noobs label compress replace




